package net.pws.common.persistence;

import java.util.List;

/**
 * @author dz
 * @param <T>
 */
public class Page<T> extends ImmutablePage<T> implements IMutablePage<T> {
    
    public static <E> Page<E> copyFrom(IPage<E> page) {
        Page<E> result = new Page<E>();
        result.setDataCountInOnePage(page.getDataCountInOnePage());
        result.setCurrentPageNo(page.getCurrentPageNo());
        result.setTotalDataCount(page.getTotalDataCount());
        result.setData(page.getData());
        return result;
    }
    
    public Page() {
        super();
    }
    
    public Page(long currentPageNo,
                long totalCount,
                int limitPerPage,
                List<T> data) {
        super(currentPageNo, totalCount, limitPerPage, data);
    }
    
    /*
     * (non-Javadoc)
     * @see
     * com.xlbs.common.persistence.IMutablePage#setDataCountInOnePage
     * (int)
     */
    public void setDataCountInOnePage(int dataCountInOnePage) {
        this.dataCountInOnePage = dataCountInOnePage;
    }
    
    /*
     * (non-Javadoc)
     * @see
     * com.xlbs.common.persistence.IMutablePage#setCurrentPageNo(long)
     */
    public void setCurrentPageNo(long currentPageNo) {
        this.currentPageNo = currentPageNo;
    }
    
    /*
     * (non-Javadoc)
     * @see
     * com.xlbs.common.persistence.IMutablePage#setData(java.util.
     * List)
     */
    public void setData(List<T> data) {
        this.data = data;
    }
    
    /*
     * (non-Javadoc)
     * @see
     * com.xlbs.common.persistence.IMutablePage#setTotalDataCount(
     * long)
     */
    public void setTotalDataCount(long totalDataCount) {
        this.totalDataCount = totalDataCount;
    }
    
}
